﻿using System;
using System.Collections.Generic;
using System.Linq;



using Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Cookies;
using System.Configuration;
using System.Globalization;



namespace WorkBasket
{
    public partial class Startup
    {
        private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
        private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
        private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"];
        private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];


        private string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);


        public void ConfigureAuth(IAppBuilder app)
        {
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);


            app.UseCookieAuthentication(new CookieAuthenticationOptions());


            //app.UseOpenIdConnectAuthentication(
            //    new OpenIdConnectAuthenticationOptions
            //    {
            //        Client_Id = clientId,
            //        Authority = authority,
            //        Post_Logout_Redirect_Uri = postLogoutRedirectUri
            //    });
        }
    }
}
